<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:xi="http://www.w3.org/2001/XInclude"
      xmlns:py="http://genshi.edgewall.org/">
    <xi:include href="master.html" />

<?python
    from mnemoply.common_knowledge import month_captions
    from mnemoply.utils import format_currency
?>

<head />

<body>
    <div py:if="not records">
        <p>Hours for this students not found or payment has been already charged.</p>
        <span>${ET(tg.back_widget())}</span>
    </div>
    <div py:if="records">
        <div align="center">
            <span>Payment for </span>
            <span>${month_captions[month]}</span>
            <span>${year}</span>
        </div>

        <table class="maintable">
            <thead>
            <tr>
                <td>Student</td>
                <td>Agreement</td>
                <td>Planned hours</td>
                <td>Real hours</td>
                <td>Tariff</td>
                <td>Discont</td>
                <td>Amount</td>
            </tr>
            </thead>

            <tbody>
                <tr py:for="obj in records">
                    <td>
                        <a href="/Student/${obj.student.id}/">${obj.student.title}</a>
                    </td>

                    <td><a href="/StudentAgreement/${obj.studentAgreement.id}/">${obj.studentAgreement.title}</a></td>
                    <td>${obj.plannedHours}</td>
                    <td>${obj.realHours}</td>
                    <td>${format_currency(obj.tariff)}</td>
                    <td><span py:if="obj.discont">${obj.discont.title}</span></td>
                    <td>${format_currency(obj.amount)}</td>
                </tr>
            </tbody>
        </table>

        <div align="center">
            <form py:if="len(records) > 0" action="/Report/Oplata/generate" method="POST">
                <input type="hidden" name="ids" value="${','.join([str(x.id) for x in sigs])}" />
                <input type="hidden" name="charge_month" value="${month}" />
                <input type="hidden" name="charge_year" value="${year}" />

                <input type="submit" value="${_('Print payment documents')}" />
            </form>

            <span py:if="len(records) == 0">
                For selected students
            </span>

            <br />

            <span>${ET(tg.back_widget())}</span>
        </div>
    </div>
</body>
</html>
